import request from '@/utils/request'

const useAssetCategoryStore = defineStore(
  'classify',
  {
    state: () => ({
      // 列表
        list: null,
        // 用户列表
      treeData: []
    }),
    actions: {
        // 获取类别列表
        async getList() {
            if (this.list) {
                return this.list;
            }
            this.list = await request({
                url: '/wms/assetCategory/listAll'
            });
            return this.list;
        },
        setList(list) {
            this.list = list;
        },
      // 获取用户列表
      getTreeData() {
        return this.treeData;
      },
      // 设置用户列表
      setTreeData(treeData) {
        this.treeData = treeData;
      },
    }
  })

export default useAssetCategoryStore
